﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Reflection;

using ZhimeiSoft.Framework.Common.RefectUtils;
using ZhimeiSoft.CharmManager.Server.DAL.Interface;

namespace ZhimeiSoft.CharmManager.Server.Factory
{
    public class BaseDalFactory
    {
        private static readonly string path = ConfigurationSettings.AppSettings["BusinessDalImpl"];

        private BaseDalFactory() { }

        public static IEmployeeDAL CreateEmployeeDal()
        {
            string className = path + ".EmployeeDAL";
            return (IEmployeeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ICustomerDAL CreateCustomerDal()
        {
            string className = path + ".CustomerDAL";
            return (ICustomerDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IEmployeeVacationDAL CreateEmployeeVacationDal()
        {
            string className = path + ".EmployeeVacationDAL";
            return (IEmployeeVacationDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ISalonInfoDAL CreateSalonInfoDal()
        {
            string className = path + ".SalonInfoDAL";
            return (ISalonInfoDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IScheduleDAL CreateScheuleDal()
        {
            string className = path + ".ScheduleDAL";
            return (IScheduleDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IServiceItemDAL CreateServiceItemDal()
        {
            string className = path + ".ServiceItemDAL";
            return (IServiceItemDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IServiceItemCategoryDAL CreateServiceItemCategoryDal()
        {
            string className = path + ".ServiceItemCategoryDAL";
            return (IServiceItemCategoryDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IReservationDAL CreateReservationDal()
        {
            string className = path + ".ReservationDAL";
            return (IReservationDAL)Assembly.Load(path).CreateInstance(className);
        }
        public static IToDoListDAL CreateToDoListDal()
        {
            string className = path + ".ToDoListDAL";
            return (IToDoListDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IServiceItemDetailDAL CreateServiceItemDetailDal()
        {
            string className = path + ".ServiceItemDetailDAL";
            return (IServiceItemDetailDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ICustomerServiceItemDAL CreateCustomerServiceItemDal()
        {
            string className = path + ".CustomerServiceItemDAL";
            return (ICustomerServiceItemDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ICustomerServiceItemReservationTimeDAL CreateCustomerServiceItemReservationTimeDal()
        {
            string className = path + ".CustomerServiceItemReservationTimeDAL";
            return (ICustomerServiceItemReservationTimeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ICustomerReturnVisitDAL CreateCustomerReturnVisitDal()
        {
            string className = path + ".CustomerReturnVisitDAL";
            return (ICustomerReturnVisitDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static IPayTypeDAL CreatePayTypeDal()
        {
            string className = path + ".PayTypeDAL";
            return (IPayTypeDAL)Assembly.Load(path).CreateInstance(className);
        }

        public static ICustomerPaymentDAL CreateCustomerPaymentDal()
        {
            string className = path + ".CustomerPaymentDAL";
            return (ICustomerPaymentDAL)Assembly.Load(path).CreateInstance(className);
        }
    }
}
